<template>
  <div class="notarial">
    <div class="notarial-list">
      <el-row :gutter="12">
        <el-col :span="6">
          <el-card shadow="hover"> 所属公证处: {{ notarialDetail.company.name }} </el-card>
        </el-col>
        <el-col :span="6">
          <el-card shadow="hover"> 公证处总支出: {{ notarialDetail.releaseAllMoney || 0 }} </el-card>
        </el-col>
				<el-col :span="6">
          <el-card shadow="hover"> 公证处总收益: {{ notarialDetail.checkAllMoney || 0 }} </el-card>
        </el-col>
        <el-col :span="6">
          <el-card shadow="hover"> 公证处积分: {{ notarialDetail.company.score || 0 }} </el-card>
        </el-col>
      </el-row>
    </div>
    <div class="notarial-list">
      <el-tabs v-model="activeName" type="card">
        <el-tab-pane label="发布订单" name="release">
					<el-table
                :data="notarialDetail.releaseTask"
                border>
                <el-table-column
                    prop="taskType"
                    align="center"
                    label="公证业务">
                </el-table-column>
                <el-table-column
                    prop="price"
                    align="center"
                    label="出价/元">
                </el-table-column>
								<el-table-column
                    prop="evalScore"
                    align="center"
                    label="订单积分">
                </el-table-column>
                <el-table-column
                    prop="userName"
                    align="center"
                    label="发布人">
                </el-table-column>
								<el-table-column
                    align="center"
                    prop="name"
                    label="状态">
                     <template #default="scope">
                         <el-tag size="small" type="success">{{ taskStatus[scope.row.status] }}</el-tag>
                    </template>
                </el-table-column>
                <el-table-column
                    prop="createTime"
                    align="center"
                    label="创建时间">
                </el-table-column>
								<el-table-column
                    prop="updateTime"
                    align="center"
                    label="更新时间">
                </el-table-column>
            </el-table>
				</el-tab-pane>
        <el-tab-pane label="审核订单" name="check">
					<el-table
                :data="notarialDetail.checkTask"
                border>
                <el-table-column
                    prop="taskType"
                    align="center"
                    label="公证业务">
                </el-table-column>
                <el-table-column
                    prop="price"
                    align="center"
                    label="出价/元">
                </el-table-column>
								<el-table-column
                    prop="evalScore"
                    align="center"
                    label="订单积分">
                </el-table-column>
                <el-table-column
                    prop="userName"
                    align="center"
                    label="发布人">
                </el-table-column>
								<el-table-column
                    align="center"
                    prop="name"
                    label="状态">
                     <template #default="scope">
                         <el-tag size="small" type="success">{{ taskStatus[scope.row.status] }}</el-tag>
                    </template>
                </el-table-column>
                <el-table-column
                    prop="createTime"
                    align="center"
                    label="创建时间">
                </el-table-column>
								<el-table-column
                    prop="updateTime"
                    align="center"
                    label="更新时间">
                </el-table-column>
            </el-table>
				</el-tab-pane>
      </el-tabs>
    </div>
  </div>
</template>
<script lang="ts">
import { defineComponent, computed, onMounted, ref, toRaw, reactive } from 'vue';
import { useStore } from 'vuex';
import { TASK_STATUS } from '@/config'
export default defineComponent({
  name: 'natarialMine',
  components: {},
  setup() {
    const store = useStore();
		const activeName = ref('release');
    const notarialDetail = reactive({
      checkAllMoney: 0,
      releaseAllMoney: 0,
      releaseTask: [],
      checkTask: [],
      company: {
        name: '',
        score: '',
        address: '',
      },
    });
    // 获取我的发布列表
    const getDetail = async () => {
      const { checkAllMoney, releaseAllMoney, releaseTask, checkTask, company } = await store.dispatch(
        'company/getCompanyMine',
      );
      notarialDetail.checkAllMoney = checkAllMoney;
      notarialDetail.releaseAllMoney = releaseAllMoney;
      notarialDetail.releaseTask = releaseTask;
      notarialDetail.checkTask = checkTask;
      notarialDetail.company = company;
    };
    const userInfo = computed(() => {
      return store.getters.userInfo;
    });
		const taskStatus = computed(() => {
			return TASK_STATUS;
		});
    onMounted(() => {
      getDetail();
    });
    return {
			activeName,
      userInfo,
      notarialDetail,
			taskStatus,
    };
  },
});
</script>
<style lang="scss" scoped>
.notarial {
  &-btns {
    @extend %container;
  }
  &-list {
    @extend %container;
    margin-top: 10px;
  }
}
</style>